﻿using System;
using System.Configuration;
using System.Web.Profile;

namespace NWebMock
{
    public class ProfileBaseWrapper : IProfileBase
    {
        #region Constructors

        public ProfileBaseWrapper(ProfileBase profile)
        {
            if (profile == null)
            {
                throw new ArgumentNullException("profile");
            }

            this.innerProfile = profile;
        }

        #endregion

        #region Fields

        private ProfileBase innerProfile = null;

        #endregion

        #region Properties

        public SettingsContext Context { get { return this.innerProfile.Context; } }

        public bool IsAnonymous { get { return this.innerProfile.IsAnonymous; } }

        public bool IsDirty { get { return this.innerProfile.IsDirty; } }

        public bool IsSynchronized { get { return this.innerProfile.IsSynchronized; } }

        public object this[string propertyName] { get { return this.innerProfile[propertyName]; } set { this.innerProfile[propertyName] = value; } }

        public DateTime LastActivityDate { get { return this.innerProfile.LastActivityDate; } }

        public DateTime LastUpdatedDate { get { return this.innerProfile.LastUpdatedDate; } }

        public SettingsPropertyValueCollection PropertyValues { get { return this.innerProfile.PropertyValues; } }

        public SettingsProviderCollection Providers { get { return this.innerProfile.Providers; } }

        public string UserName { get { return this.innerProfile.UserName; } }

        #endregion

        #region Methods

        public ProfileGroupBase GetProfileGroup(string groupName)
        {
            return this.innerProfile.GetProfileGroup(groupName);
        }

        public object GetPropertyValue(string propertyName)
        {
            return this.innerProfile.GetPropertyValue(propertyName);
        }

        public void Save()
        {
            this.innerProfile.Save();
        }

        public void SetPropertyValue(string propertyName, object propertyValue)
        {
            this.innerProfile.SetPropertyValue(propertyName, propertyValue);
        }

        #endregion
    }
}
